package com.itany.corejava.day10;

import java.util.Arrays;
import java.util.Comparator;

public class Test1 {

    public static void main(String[] args) {

        Circle c1=new Circle(5);
        Circle c2=new Circle(2);
        Rectangle r1=new Rectangle(5,2);
        Rectangle r2=new Rectangle(6,3);
        Triangle t1=new Triangle(7,2);
        Triangle t2=new Triangle(3,5);

        Graphics[] graphics={c1,c2,r1,r2,t1,t2};

        Arrays.sort(graphics);

        Arrays.sort(graphics, new Comparator<Graphics>() {
            @Override
            public int compare(Graphics o1, Graphics o2) {
                return new Double(o2.area()).compareTo(o1.area());
            }
        });



    }


}
